﻿using CTM.Web.Models;
using System.Collections.Generic;
using System.Web;

namespace CTM.Web.Utils
{
    public static class GlobalVariables
    {
        // read-write variable
        public static ApplicationUser SelectedUser
        {
            get
            {
                return HttpContext.Current.Session["SELECTED_USER"] as ApplicationUser;
            }
            set
            {
                HttpContext.Current.Session["SELECTED_USER"] = value;
            }
        }

        public static ApplicationUser CurrentUser
        {
            get
            {
                return HttpContext.Current.Session["CURRENT_USER"] as ApplicationUser;
            }
            set
            {
                HttpContext.Current.Session["CURRENT_USER"] = value;
            }
        }

        public static IList<CTM.Web.Models.Input.ApplicationRole> CurrentUserRoles
        {
            get
            {
                return HttpContext.Current.Session["CURRENT_USER_ROLES"] as IList<CTM.Web.Models.Input.ApplicationRole>;
            }
            set
            {
                HttpContext.Current.Session["CURRENT_USER_ROLES"] = value;
            }
        }
    }
}